class FareMode < ApplicationRecord
  belongs_to :fare_template

  has_many :fare_mode_provinces, dependent: :destroy
  has_many :provinces, through: :fare_mode_provinces

  validates :first_n_piece, presence: true, numericality: { greater_than_or_equal_to: 0,  only_integer: true }
  validates :first_amount, presence: true, numericality: { greater_than_or_equal_to: 0 }
  validates :second_n_piece, presence: true, numericality: { greater_than_or_equal_to: 0,  only_integer: true }
  validates :second_amount, presence: true, numericality: { greater_than_or_equal_to: 0 }
  
end
